SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS OFF
GO
CREATE PROCEDURE [dbo].[paCertificaInscAprobAsist]

	@instancia INT ,
	@inscriptos INT OUTPUT,
             @aprobados INT OUTPUT,
	@asistidos INT OUTPUT
            

AS
SET NOCOUNT ON
SET DATEFORMAT DMY
SELECT @inscriptos=count(*) FROM tb_participantes p INNER JOIN tb_tiposparticipantes tp ON p.IdTipoParticipante=tp.IdTipoParticipante WHERE p.idinstancia=@instancia AND tp.asiste='S'
SELECT @aprobados=count(*) FROM tb_participantes p INNER JOIN tb_tiposparticipantes tp ON p.IdTipoParticipante=tp.IdTipoParticipante WHERE p.idinstancia=@instancia AND tp.asiste='S' AND aprobado=1
SELECT @asistidos=count(*) FROM tb_participantes p INNER JOIN tb_tiposparticipantes tp ON p.IdTipoParticipante=tp.IdTipoParticipante WHERE p.idinstancia=@instancia AND tp.asiste='S' AND asistencia=1


RETURN
GO
GRANT EXECUTE ON  [dbo].[paCertificaInscAprobAsist] TO [Certificaciones]
GRANT EXECUTE ON  [dbo].[paCertificaInscAprobAsist] TO [CertificacionesAdministracion]
GO
